import Vue from 'vue';
import Router from 'vue-router';

//所用
import Home from './pages/home';
import Index from './pages/index';
import Product from './pages/product';
import Detail from './pages/detail';
import Cart from './pages/cart';
import Order from './pages/order';
import OrderList from './pages/orderList.vue'



// 加载插件的语法
Vue.use(Router);

export default new Router({
    mode: 'history',
    routes: [
        {
            path: '/',
            name: 'home',
            component: Home,
            redirect:"/index",
            children: [
                {
                    path: '/index',
                    name: 'index',
                    component: Index
                },
                {
                    path: '/product/:id',
                    name: 'product',
                    component: Product
                },
                {
                    path: '/detail/:id',
                    name: 'detail',
                    component: Detail
                },
               
            ]
        },
        {
            path: '/cart',
            name: 'cart',
            component:Cart
        },
        {
            path: '/order',
            name: 'orer',
            component:Order,
            children:[
                {
                    path:'list',
                    name:'order-list',
                    component:OrderList
                },
                {
                    path:'/confirm',
                    name:'order-confirm',
                    component: () => import('./pages/orderConfirm.vue')
                },
                {
                    path:'/pay',
                    name:'order-pay',
                    component: () => import('./pages/orderPay.vue')
                },
            ]
        },
    ]
})